//
//  XDCollectionReusableView.m
//  Le way walkers
//
//  Created by YaZhiLiang on 15/5/14.
//  Copyright (c) 2015年 LTXZ. All rights reserved.
//

#import "XDCollectionReusableView.h"

@implementation XDCollectionReusableView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createReusableView];
        
    }
    return self;
}


- (void)dealloc
{
    [_title release];
    [_myView release];
    [_button release];
    [super dealloc];
}

- (void)createReusableView
{
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(40,0,336, 60)];
    
    
    self.title.textColor = [UIColor colorWithRed:63 / 255.0 green:110 / 255.0 blue:117 / 255.0 alpha:1];
    
    self.title.font = [UIFont systemFontOfSize:18.0];
    
//    self.title.backgroundColor = [UIColor blueColor];
    
    [self addSubview:self.title];
    
    self.title.userInteractionEnabled = YES;
    
    [_title release];
    
    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
    
    self.button.frame = CGRectMake(0, self.title.frame.origin.y, self.title.frame.size.width, self.title.frame.size.height);
    
    [self.button setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
    
//    [self.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.title addSubview:self.button];
    
    
//    UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)] autorelease];
//    
//    [self.title addGestureRecognizer:tap];

    
    self.myView = [[[UIView alloc]initWithFrame:CGRectMake(20, 22, 8, 18)] autorelease];
    
    self.myView.backgroundColor = [UIColor colorWithRed:70 / 255.0 green:151 /255.0 blue:198 / 255.0 alpha:1];
    
    self.myView.layer.cornerRadius = 3;
    
    self.myView.layer.masksToBounds = YES;
    
    [self addSubview:self.myView];
    
}

- (void)setXdPlace:(XDPlace *)xdPlace
{
    if (_xdPlace != xdPlace) {
        
        [_xdPlace release];
        
        _xdPlace = [xdPlace retain];
    }
    
    self.title.text = xdPlace.title;
    
}

//- (void)buttonAction:(UIButton *)button
//{
//    [self.myDlelegate getModelDelegate];
//}

@end
